package com.chixing.day02;

//浏览器网站筛选公功能网址拼接
public class WebConcat {
    public static void main(String[] args) {
        String result = "https://search.51job.com";
        String[] workYearArr = {"所有","在校生/应届生","1-3年","3-5年","5-10年","10年以上","无需经验"};
        String[] salaryArray = {"所有","2k以下","2-4k","4-5k","5-7k","7-9k","9-10k","10k以上"};
        String[] degreeArray = {"所有","初中及以下","高中/中专/大专","本科","硕士","博士","无学历要求"};
        String[] companyTypeArray = {"所有","国企","外资","上市公司","合资","民营企业","央企"};

        int workYearIndex = 1;  // 选择了 "在校生/应届生"
        int salaryIndex = 2;   // 选择了 "2-4k"
        int degreeIndex = 4;   // 选择了 "硕士"
        int companyTypeIndex = 2; // 选择了 "外资"

        /*begin*/
        if (workYearIndex > 0 && workYearIndex <= workYearArr.length - 1) {
            result += "?workYear=" + workYearArr[workYearIndex];
        }
        if (degreeIndex > 0 && degreeIndex <= degreeArray.length - 1) {
            result += "&degree=" + degreeArray[degreeIndex];
        }
        if (companyTypeIndex > 0 && companyTypeIndex <= companyTypeArray.length - 1) {
            result += "&companyType=" + companyTypeArray[companyTypeIndex];
        }
        if(result.endsWith("&"))
            result=  result.substring(0,result.length()-1); // "hello"
        System.out.println(result);








        result += "?workYear=在校生/应届生&minsalary=2000&maxsalary=4000&degree=硕士&companyType=外资";

        // 若以上选择了所有,则不传值
//        companyTypeArrayworkYear = 1;
//        salary = 0;
//        degree = 0;
//        companyType = 2;

        result += "?workYear=在校生/应届生&companyType=外资";
    }
}
